<?php
$ArSatisfactionReport = Dracosys::getSessionValue(SESSION_INTERFACE, 'SatisfactionReport');
$ArSatisfactionEvaluationReport = Dracosys::getSessionValue(SESSION_INTERFACE, 'SatisfactionEvaluationsReport');
$ArEvaluationsNumberReport = Dracosys::getSessionValue(SESSION_INTERFACE, 'EvaluationsNumberReport');
?>
<h2>Relat&oacute;rio Satisfação do Cliente</h2>
<section id="SatisfactionReport">
    <table id="SatisfactionReport_ReportSatisfaction" class="Report">
        <thead>
            <tr>
                <th colspan="8">Clientes Mais Satisfeitos</th>
            </tr>
            <tr class="header">
                <td width="20%">Cliente</td>
                <td width="10%">N&ordm; de Chamados</td>
                <td width="13%">Chamados Fechados</td>
                <td width="13%">N&ordm; de Avalia&ccedil;&otilde;es</td>
                <td width="6%">Ótimo</td>
                <td width="6%">MuitoBom</td>
                <td width="6%">Regular</td>
                <td width="5%">P&eacute;ssimo</td>
            </tr>
        </thead>
        <tbody>
            <?php if(!empty($ArSatisfactionReport)): ?>
            <?php foreach($ArSatisfactionReport as $Report): ?>
                <tr>
                    <td><?=$Report['Customer']->getCustomerName()?></td>
                    <td><?=$Report['Called']['EXTERNO']?></td>
                    <td><?=$Report['Called']['EXTERNO_FECHADO']?></td>
                    <td><?=$Report['Evaluations']['TOTAL']?></td>
                    <td><?=$Report['Evaluations']['OTIMO']?></td>
                    <td><?=$Report['Evaluations']['MUITO BOM']?></td>
                    <td><?=$Report['Evaluations']['REGULAR']?></td>
                    <td><?=$Report['Evaluations']['PESSIMO']?></td>
                </tr>
            <?php endforeach; ?>
            <?php endif; ?>
        </tbody>
    </table>

    <table id="SatisfactionReport_ReportEvaluation" class="Report hide">
        <thead>
            <tr>
                <th colspan="3">Clientes Mais Avaliaram</th>
            </tr>
            <tr class="header">
                <td width="50%">Cliente</td>
                <td width="25%">N&uacute;mero</td>
            </tr>
        </thead>
        <tbody>
            <?php if(!empty($ArEvaluationsNumberReport)): ?>
            <?php foreach($ArEvaluationsNumberReport as $Report): ?>
                <tr>
                    <td><?=$Report['Customer']->getCustomerName()?></td>
                    <td><?=$Report['EvaluationNumber']?></td>
                </tr>
            <?php endforeach; ?>
            <?php endif; ?>
        </tbody>
    </table>

    <table id="SatisfactionReport_ReportGreat" class="Report hide">
        <thead>
            <tr>
                <th colspan="3">Clientes Mais Deram Avaliação "ÓTIMO"</th>
            </tr>
            <tr class="header">
                <td width="50%">Cliente</td>
                <td width="25%">Avaliações</td>
                <td width="25%">Ótimo</td>
            </tr>
        </thead>
        <tbody>
            <?php if(!empty($ArSatisfactionEvaluationReport['OTIMO'])): ?>
            <?php foreach($ArSatisfactionEvaluationReport['OTIMO'] as $Report): ?>
                <tr>
                    <td><?=$Report['Customer']->getCustomerName()?></td>
                    <td><?=$Report['NumberOfEvaluations']['TOTAL']?></td>
                    <td><?=$Report['EvaluationTypeNumber']?></td>
                </tr>
            <?php endforeach; ?>
            <?php endif; ?>
        </tbody>
    </table>

    <table id="SatisfactionReport_ReportVeryGood" class="Report hide">
        <thead>
            <tr>
                <th colspan="3">Clientes Mais Deram Avaliação "MUITO BOM"</th>
            </tr>
            <tr class="header">
                <td width="50%">Cliente</td>
                <td width="25%">Avaliações</td>
                <td width="25%">Muito Bom</td>
            </tr>
        </thead>
        <tbody>
            <?php if(!empty($ArSatisfactionEvaluationReport['MUITO BOM'])): ?>
            <?php foreach($ArSatisfactionEvaluationReport['MUITO BOM'] as $Report): ?>
                <tr>
                    <td><?=$Report['Customer']->getCustomerName()?></td>
                    <td><?=$Report['NumberOfEvaluations']['TOTAL']?></td>
                    <td><?=$Report['EvaluationTypeNumber']?></td>
                </tr>
            <?php endforeach; ?>
            <?php endif; ?>
        </tbody>
    </table>

    <table id="SatisfactionReport_ReportRegular" class="Report hide">
        <thead>
            <tr>
                <th colspan="3">Clientes Mais Deram Avaliação "REGULAR"</th>
            </tr>
            <tr class="header">
                <td width="50%">Cliente</td>
                <td width="25%">Avaliações</td>
                <td width="25%">Regular</td>
            </tr>
        </thead>
        <tbody>
            <?php if(!empty($ArSatisfactionEvaluationReport['REGULAR'])): ?>
            <?php foreach($ArSatisfactionEvaluationReport['REGULAR'] as $Report): ?>
                <tr>
                    <td><?=$Report['Customer']->getCustomerName()?></td>
                    <td><?=$Report['NumberOfEvaluations']['TOTAL']?></td>
                    <td><?=$Report['EvaluationTypeNumber']?></td>
                </tr>
            <?php endforeach; ?>
            <?php endif; ?>
        </tbody>
    </table>

    <table id="SatisfactionReport_ReportBad" class="Report hide">
        <thead>
            <tr>
                <th colspan="3">Clientes Mais Deram Avaliação "P&Eacute;SSIMO"</th>
            </tr>
            <tr class="header">
                <td width="50%">Cliente</td>
                <td width="25%">Avaliações</td>
                <td width="25%">P&eacute;ssimo</td>
            </tr>
        </thead>
        <tbody>
            <?php if(!empty($ArSatisfactionEvaluationReport['PESSIMO'])): ?>
            <?php foreach($ArSatisfactionEvaluationReport['PESSIMO'] as $Report): ?>
                <tr>
                    <td><?=$Report['Customer']->getCustomerName()?></td>
                    <td><?=$Report['NumberOfEvaluations']['TOTAL']?></td>
                    <td><?=$Report['EvaluationTypeNumber']?></td>
                </tr>
            <?php endforeach; ?>
                <?php endif ?>
        </tbody>
    </table>

    <div class="pagination">
        <a href="#" rel="ReportSatisfaction" class="selected borderRadios">Mais Satisfeitos</a>
        <a href="#" rel="ReportEvaluation" class="nonselected borderRadios">Mais Avaliações</a>
        <a href="#" rel="ReportGreat" class="nonselected borderRadios">Ótimo</a>
        <a href="#" rel="ReportVeryGood" class="nonselected borderRadios">Muito Bom</a>
        <a href="#" rel="ReportRegular" class="nonselected borderRadios">Regular</a>
        <a href="#" rel="ReportBad" class="nonselected borderRadios">Péssimo</a>
    </div>
</section>